class ReversibleDict(dict):
    def __init__(self, *args, **kwargs):
        super(ReversibleDict, self).__init__(*args, **kwargs)
        self.inverse = {}
        for key, value in self.items():
            if value in self.inverse:
                raise ValueError(f"Duplicate value {value} found in the dictionary.")
            self.inverse[value] = key

    def __setitem__(self, key, value):
        if key in self:
            del self.inverse[self[key]]
        if value in self.inverse:
            del self[self.inverse[value]]
        super(ReversibleDict, self).__setitem__(key, value)
        self.inverse[value] = key

    def __delitem__(self, key):
        value = self[key]
        super(ReversibleDict, self).__delitem__(key)
        del self.inverse[value]

    def get_key(self, value):
        return self.inverse.get(value)

# if __name__ == '__main__':
#     d = ReversibleDict()
#     d["1"] = 2
#     print(d)
#     print(d.get_key("1"))
#     print(d.get_key(2))
